﻿using CPPEI.Coolzon.Event.Core;
using CPPEI.Coolzon.UI;
using CPPEI.Coolzon.UI.Data;
using CPPEI.Coolzon.UI.Event;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.Coolzon.Theme.Fashion.MainViewControl
{
    public partial class JSControlView
    {
        /// <summary>
        /// 设置显示模式，包括自由交互模式和按钮交互模式
        /// </summary>
        /// <param name="event">IsFreaModel，true表示自由模式，false为按钮模式</param>
        [Common.Subscribe]
        public void OnSetShowModel(SetShowModelEvent @event)
        {
            IsFreeModel = @event.IsFreeModel;
        }

        /// <summary>
        /// 设置当前场景自定义事件按钮
        /// </summary>
        [Common.Subscribe]
        public void OnShowJSControl(ShowRecordEvent @event)
        {
            CPPEI.Coolzon.UI.Views.RenderView renderView = (CPPEI.Coolzon.UI.Views.RenderView)UI.UIContext.Current.RenderView;
            if (IsFreeModel)
            {
                this.Visibility = System.Windows.Visibility.Hidden;
                renderView.Visibility = System.Windows.Visibility.Visible;
                renderView.ValidateCurrentPartVisibleRange();
            }
            else
            {
                this.Visibility = System.Windows.Visibility.Visible;
                renderView.Visibility = System.Windows.Visibility.Hidden;
            }
        }
    }
}
